namespace Collection.Entities
{
    using System;


    /// <summary>
    /// 表名：LotteryDetails 主键列：Id
    /// </summary>
    [SerializableAttribute()]
    public partial class _LotteryDetails : MySoft.Data.Entity
    {

        protected Int32 _Id;

        protected Int64 _BriefingId;

        protected Int32 _RewardLevels;

        protected Int64 _Quantity;

        protected Decimal _UnitPrice;

        public Int32 Id
        {
            get
            {
                return this._Id;
            }
            set
            {
                this.OnPropertyValueChange(_.Id, _Id, value);
                this._Id = value;
            }
        }

        /// <summary>
        /// 公告Id外键
        /// </summary>
        public Int64 BriefingId
        {
            get
            {
                return this._BriefingId;
            }
            set
            {
                this.OnPropertyValueChange(_.BriefingId, _BriefingId, value);
                this._BriefingId = value;
            }
        }

        /// <summary>
        /// 中奖等级
        /// </summary>
        public Int32 RewardLevels
        {
            get
            {
                return this._RewardLevels;
            }
            set
            {
                this.OnPropertyValueChange(_.RewardLevels, _RewardLevels, value);
                this._RewardLevels = value;
            }
        }

        /// <summary>
        /// 中奖数量
        /// </summary>
        public Int64 Quantity
        {
            get
            {
                return this._Quantity;
            }
            set
            {
                this.OnPropertyValueChange(_.Quantity, _Quantity, value);
                this._Quantity = value;
            }
        }

        /// <summary>
        /// 单笔金额
        /// </summary>
        public Decimal UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                this.OnPropertyValueChange(_.UnitPrice, _UnitPrice, value);
                this._UnitPrice = value;
            }
        }

        /// <summary>
        /// 获取实体对应的表名
        /// </summary>
        protected override MySoft.Data.Table GetTable()
        {
            return new MySoft.Data.Table<_LotteryDetails>("LotteryDetails");
        }

        /// <summary>
        /// 获取实体中的标识列
        /// </summary>
        protected override MySoft.Data.Field GetIdentityField()
        {
            return _.Id;
        }

        /// <summary>
        /// 获取实体中的主键列
        /// </summary>
        protected override MySoft.Data.Field[] GetPrimaryKeyFields()
        {
            return new MySoft.Data.Field[] {
    					_.Id};
        }

        /// <summary>
        /// 获取列信息
        /// </summary>
        protected override MySoft.Data.Field[] GetFields()
        {
            return new MySoft.Data.Field[] {
    					_.Id,
    					_.BriefingId,
    					_.RewardLevels,
    					_.Quantity,
    					_.UnitPrice};
        }

        /// <summary>
        /// 获取列数据
        /// </summary>
        protected override object[] GetValues()
        {
            return new object[] {
    					this._Id,
    					this._BriefingId,
    					this._RewardLevels,
    					this._Quantity,
    					this._UnitPrice};
        }

        /// <summary>
        /// 给当前实体赋值
        /// </summary>
        protected override void SetValues(MySoft.Data.IRowReader reader)
        {
            if ((false == reader.IsDBNull(_.Id)))
            {
                this._Id = reader.GetInt32(_.Id);
            }
            if ((false == reader.IsDBNull(_.BriefingId)))
            {
                this._BriefingId = reader.GetInt32(_.BriefingId);
            }
            if ((false == reader.IsDBNull(_.RewardLevels)))
            {
                this._RewardLevels = reader.GetInt32(_.RewardLevels);
            }
            if ((false == reader.IsDBNull(_.Quantity)))
            {
                this._Quantity = reader.GetInt64(_.Quantity);
            }
            if ((false == reader.IsDBNull(_.UnitPrice)))
            {
                this._UnitPrice = reader.GetDecimal(_.UnitPrice);
            }
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            if ((obj == null))
            {
                return false;
            }
            if ((false == typeof(_LotteryDetails).IsAssignableFrom(obj.GetType())))
            {
                return false;
            }
            if ((((object)(this)) == ((object)(obj))))
            {
                return true;
            }
            return false;
        }

        public class _
        {

            /// <summary>
            /// 表示选择所有列，与*等同
            /// </summary>
            public static MySoft.Data.AllField All = new MySoft.Data.AllField<_LotteryDetails>();

            /// <summary>
            /// 字段名：Id - 数据类型：Int32
            /// </summary>
            public static MySoft.Data.Field Id = new MySoft.Data.Field<_LotteryDetails>("Id");

            /// <summary>
            /// 公告Id外键 - 字段名：BulletinId - 数据类型：Int32
            /// </summary>
            public static MySoft.Data.Field BriefingId = new MySoft.Data.Field<_LotteryDetails>("BriefingId");

            /// <summary>
            /// 中奖等级 - 字段名：RewardLevels - 数据类型：Int32
            /// </summary>
            public static MySoft.Data.Field RewardLevels = new MySoft.Data.Field<_LotteryDetails>("RewardLevels");

            /// <summary>
            /// 中奖数量 - 字段名：Quantity - 数据类型：Int64
            /// </summary>
            public static MySoft.Data.Field Quantity = new MySoft.Data.Field<_LotteryDetails>("Quantity");

            /// <summary>
            /// 单笔金额 - 字段名：UnitPrice - 数据类型：Decimal
            /// </summary>
            public static MySoft.Data.Field UnitPrice = new MySoft.Data.Field<_LotteryDetails>("UnitPrice");
        }
    }
}
